// pages/myconcern/myconcern.js
let util = require("../../utils/util.js");
var baseImgUrl = util.baseImgUrl;
let app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    activeIndex:'',
    scanSrc:baseImgUrl+"scan.png",
    audio_bg: baseImgUrl +"audio_bg.png",
    audio_s: baseImgUrl +"audio_s.png",
    navList:[{
        id:0,
        navName:"文章"
    }, {
        id: 1,
        navName: "达人"
      }, {
        id: 2,
        navName: "足迹"
      }, {
        id: 3,
        navName: "粉丝"
      }],
    kong_wenzhang:baseImgUrl+"kongSrc1.png",
    kong_daren: baseImgUrl + "kongSrc2.png",
    kong_zuji: baseImgUrl + "kongSrc3.png",
    kong_fensi: baseImgUrl + "kongSrc2.png",
    // 文章列表测试数据
    newslists: [{
      id: 1,
      types: 1,//新闻类型
      title: "网上下拉刷新的例子挺多的，我也用了试成功了一个，但目前发现，当本来listView内容过少不能充满父容器的时候，下拉刷新的头部",
      name: "广告",
      user_nickname: "医学护肤",
      dianji: 100,
      media: [baseImgUrl + "pic0.png", baseImgUrl + "pic0.png", baseImgUrl + "pic0.png"],
      color: true
    },
    {
      id: 2,
      types: 2,//新闻类型
      title: "网上下拉刷新的例子挺多的，我也用了试成功了一个，但目前发现，当本来listView内容过少不能充满父容器的时候，下拉刷新的头部",
      name: "广告",
      user_nickname: "医学护肤",
      dianji: 100,
      media: [baseImgUrl + "pic0.png", baseImgUrl + "pic0.png", baseImgUrl + "pic0.png"],
      color: false
    },
      {
        id: 3,
        types: 3,//新闻类型
        title: "网上下拉刷新的例子挺多的，我也用了试成功了一个，但目前发现，当本来listView内容过少不能充满父容器的时候，下拉刷新的头部",
        name: "广告",
        user_nickname: "医学护肤",
        dianji: 100,
        media: [baseImgUrl + "pic0.png", baseImgUrl + "pic0.png", baseImgUrl + "pic0.png"],
        color: true
      },
      {
        id:4,
        types: 6,//新闻类型
        title: "网上下拉刷新的例子挺多的，我也用了试成功了一个，但目前发现，当本来listView内容过少不能充满父容器的时候，下拉刷新的头部",
        name: "广告",
        user_nickname: "医学护肤",
        dianji: 100,
        media: [baseImgUrl + "/pic0.png", baseImgUrl + "/pic0.png", baseImgUrl + "/pic0.png"],
        color: false
      }],
    darenlists:[{
      id:0,
      logoSrc:baseImgUrl+"userlogo.png",
      username:"张三",
      num:10,
      followFlag:true
    }, {
        id: 1,
        logoSrc: baseImgUrl + "userlogo.png",
        username: "张三",
        num: 10,
        followFlag: true
      }, {
        id: 2,
        logoSrc: baseImgUrl + "userlogo.png",
        username: "张三",
        num: 10,
        followFlag: true
      }, {
        id: 3,
        logoSrc: baseImgUrl + "userlogo.png",
        username: "张三",
        num: 10,
        followFlag: false
      }, {
        id: 4,
        logoSrc: baseImgUrl + "userlogo.png",
        username: "张三",
        num: 10,
        followFlag: false
      }]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      console.log("onload");
      var thisid=options.thisid;
      var that=this;
      that.setData({
        activeIndex:thisid
      })
  },

  /*******点击顶部导航栏切换导航菜单******** */
  clickNav:function(e){
    var that = this;
    var thisid=e.currentTarget.id*1;
      that.setData({
        activeIndex:thisid
      })
  },
  /**************取消关注******************* */
  quxiaoguanzhu:function(e){
      var  that=this;
      console.log(e);
      console.log(that);
    var activeIndex = that.data.activeIndex;
    var thisid=e.currentTarget.id;
    wx.showModal({
      cancelColor:"#888",
      confirmColor:"#d33a3d",
      content: '确定不再关注此人',
      success(res) {
        if (res.confirm) {
          console.log('用户点击确定');
         that.data.darenlists[thisid].followFlag=false;
         that.setData({
           darenlists: that.data.darenlists
         })
          //请求接口，刷新数据
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })

  },

  /*************关注***************** */
  guanzhu:function(e){
      var taht=this;
      var thisid=e.currentTarget.id;
      that.data.darenlists[thisid].followFlag=true;
      that.setData({
        darenlists: darenlists
      })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})